// 包含两种I/O库，可以使用任一种输入输出方式
#include <iostream>
#include <stdio.h>
using namespace std;
bool isprimeNumber(int);
int *sumOfPrime(int, int);
int main()
{
    int n, k;
    // 请在此添加代码，输入n和k，并输出n以内k个素数以及它们的和
    /********** Begin *********/
    cin >> n;
    cin >> k;
    /********** End **********/
    int *array = sumOfPrime(n, k);
    for (int i = 0; i < k + 1; i++)
    {
        if (array[i] != 0)
        {
            cout << array[i] << " ";
        }
    }
    //int n;
    //cin >> n;
    //cout << isprimeNumber(n) << endl;
    return 0;
}

int *sumOfPrime(int n, int k)
{
    int *array = new int[k + 1];
    int count = 0;
    for (int i = n; i >= 2; i--)
    {
        if ((count != k) && (isprimeNumber(i)))
        {
            array[count++] = i;
        }
    }
    //cout << "count=" << count << endl;
    array[count] = 0;
    for (int i = 0; i < count; i++)
    {
        //cout << array[count] << endl;
        array[count] += array[i];
    }
    // cout << array[count] << "-----------" << endl;
    return array;
}

bool isprimeNumber(int n)
{
    if (n == 1 || n == 4)
    {
        //cout << "No" << endl;
        return false;
    }
    for (int i = 2; i < n / 2; i++)
    {
        if (n % i == 0)
        {
            //cout << "No" << endl;
            return false;
        }
    }
    //cout << "Yes" << endl;
    return true;
}